package org.cvcsc.weproject.controller.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import org.cvcsc.weproject.domain.Clazz;

@Schema(description = "保存班级信息的响应数据传输对象")
public class ResponseDtoSaveClazzes {

    @Schema(description = "班级ID", example = "1")
    private Long id;

    @Schema(description = "班级名称", example = "计算机科学与技术1班")
    private String name;

    @Schema(description = "班级编号", example = "CS101")
    private String number;

    // 构造方法、Getter 和 Setter
    public ResponseDtoSaveClazzes() {}

    public ResponseDtoSaveClazzes(Long id, String name, String number) {
        this.id = id;
        this.name = name;
        this.number = number;
    }

    public Long getId() { return id; }
    public void setId(Long id) { this.id = id; }

    public String getName() { return name; }
    public void setName(String name) { this.name = name; }

    public String getNumber() { return number; }
    public void setNumber(String number) { this.number = number; }

    // 静态工厂方法：将 Clazz 实体转换为 ResponseDtoSaveClazzes
    public static ResponseDtoSaveClazzes fromEntity(Clazz clazz) {
        return new ResponseDtoSaveClazzes(clazz.getId(), clazz.getName(), clazz.getNumber());
    }
}
